import { defHttp } from '/@/utils/http/axios';
import { ProjectManagementUser, ProjectManagement } from './model/projectManage';
enum Api {
  ProjectManagement = '/zkrq/projectState/list',
  ProjectManagementUser = '/zkrq/builder/list',
  ProjectList = '/zkrq/project/list',
  ConstructionTeamList = '/zkrq/constructionTeam/list',
  ContractorList = '/zkrq/contractor/get/contractor/list',
  GetContractorInfoList = '/zkrq/contractor/get/contractor',
  GetContractorIdList = '/zkrq/contractor/contractorId',
  UpdateContractorIdList = '/zkrq/contractor/update',
  ConstructionTeamInfo = '/zkrq/constructionTeam/contractorId',
  GetScheduleList = '/zkrq/costrevenue/list',
  GetHomePageInfo = '/zkrq/project/homePage/getHomePageInfo',
  GetUserAddress = '/zkrq/map/list',
  SearchMaterialInStatus = '/zkrq/project/material/file/in/projectId',
  SearchMaterialOutStatus = '/zkrq/project/material/file/out/projectId',
}
export const getHomePageInfoApi = (params: Indexable) =>
  defHttp.post<any>({ url: Api.GetHomePageInfo, params });

export const getProjectManagementUserApi = (params: ProjectManagementUser) =>
  defHttp.post<any>({ url: Api.ProjectManagementUser, params });
export const getProjectManagementApi = (params: ProjectManagement) =>
  defHttp.get<any>({ url: Api.ProjectManagement, params });
export const getProjectListApi = (params: ProjectManagement) =>
  defHttp.get<any>({ url: Api.ProjectList, params });
export const getConstructionTeamApi = (params?: ProjectManagement) =>
  defHttp.get<any>({ url: Api.ConstructionTeamList, params });

export const getContractorListApi = (params: ProjectManagement) =>
  defHttp.get<any>({ url: Api.ContractorList, params }); //施工队信息 //keyWord
export const getContractorInfoListApi = (params: ProjectManagement) =>
  defHttp.get<any>({ url: Api.GetContractorInfoList, params }); //获取承建商信息 //projectId

export const getContractorIdList = (
  params: any, //承建商具体信息  contractorId
) => defHttp.get<any>({ url: Api.GetContractorIdList, params });
export const getConstructionTeamInfo = (
  params: any, //1施工队具体信息
) => defHttp.get<any>({ url: Api.ConstructionTeamInfo, params });

export const updateFlowPageApi = (params?: any) =>
  defHttp.post<any>({
    url: Api.UpdateContractorIdList,
    params,
  });

export const GetScheduleList = (params: ProjectManagement) =>
  defHttp.get<any>({ url: Api.GetScheduleList, params }); //获取进度表

// 获取根据用户id获取用户经纬度信息 GetUserAddress
export const getUserAddressList = (userId: string, time?: string) =>
  defHttp.post<any>({
    url: Api.GetUserAddress,
    params: { userId, startTime: time },
  });
// 查询是否为红线内材料
export const getSearchMaterialInStatus = (params: { projectId: string }) =>
  defHttp.get<any>({
    url: Api.SearchMaterialInStatus,
    params,
  });
//查询是否为红线外材料
export const getSearchMaterialOutStatus = (params: { projectId: string }) =>
  defHttp.get<any>({
    url: Api.SearchMaterialOutStatus,
    params,
  });
